package test;

import com.google.inject.AbstractModule;
import com.google.inject.Inject;
import com.google.inject.matcher.Matchers;
import ms.aurora.app.AppWindow;
import ms.aurora.routing.Route;
import ms.aurora.routing.Router;
import test.presenter.DefaultCallback;
import test.presenter.DefaultPresenter;
import test.view.DefaultView;

public class DefaultModule extends AbstractModule {

    @Inject
    private static AppWindow appWindow;

    @Inject
    private static DefaultPresenter defaultPresenter;

    @Override
    protected void configure() {
        bindInterceptor(Matchers.any(), Matchers.annotatedWith(Route.class),
                new Router());
        bind(AppWindow.class).to(DefaultAppWindow.class).asEagerSingleton();
        bind(DefaultPresenter.MyView.class).to(DefaultView.class);
        bind(DefaultCallback.class).to(DefaultPresenter.class);
        requestStaticInjection(DefaultModule.class);
    }

    public static DefaultPresenter getDefaultPresenter() {
        return defaultPresenter;
    }

    public static AppWindow getAppWindow() {
        return appWindow;
    }
}
